//
//  AddNewItemViewController.h
//  FMS
//
//  Created by Steven on 10/14/13.
//  Copyright (c) 2013 QGSVN. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "FilterViewController.h"
#import "DatePickerViewController.h"

enum Building_Textfield_Type {
    b_room_name = 500,
    b_square_metres,
    b_date_of_completion,
    b_warranty_date_exp,
    b_construction_cost,
    b_age,
    b_cost_incurred_previous_year,
    b_cost_incurred_current_year,
    b_date_of_demolition,
    b_demolition_reason,
};

enum Facility_Textfield_Type {
    f_equipment_id = 5000,
    f_brand,
    f_serial_no,
    f_make_model,
    f_capacity,
    f_expiry_date,
    f_manufacture_detail,
    f_agent_detail,
    f_capital_cost,
    f_date_of_installation,
    f_age,
    f_amp_frequency,
    f_amp_budciet,
    f_cost_incurred_previous_year,
    f_cost_incurred_current_year,
    f_date_of_condemnation,
    f_condemnation_reason,
    f_contractor
};

@protocol AddNewItemDelegate;
@protocol DatePickerViewDelegate;

//@interface UITextField (CustomTextField)
//- (void) dealloc;
//@end

@interface AddNewItemViewController : UIViewController <UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,FilterViewDelegate,DatePickerViewDelegate,UIAlertViewDelegate> {
    NSDictionary *dictLanguage;
    UIPopoverController *popoverController;
    NSMutableArray *mainArray;
    int itemType; //Building or Facility
    UITextField *myTextField;
    
    NSString *buildingId;
    NSString *serviceId;
    NSString *campId;
    NSString *unitId;
    NSString *floorId;
    NSString *systemId;
    NSString *systemName;
    NSString *descriptionId;
    NSString *contratorId;
    NSString *roomId;
    
    NSMutableDictionary *filterDictValue;
    
    int currentAge;
    int previousAge;
}

@property (unsafe_unretained) id parent;
@property (unsafe_unretained) id<DatePickerViewDelegate> delegate;
@property (assign) BOOL isEdit;
@property (strong, nonatomic) IBOutlet TPKeyboardAvoidingTableView *mainTableView;
@property (strong, nonatomic) IBOutlet UILabel *lbMainTitle;
@property (strong, nonatomic) NSMutableDictionary *itemDetailedDict;
@property (strong, nonatomic) IBOutlet UIScrollView *mainScrollView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil itemType:(int)_itemType parent:(id)_parent;
- (IBAction)backPreviousView:(id)sender;
- (IBAction)saveItem:(id)sender;

@end
